<?php if ($this->previewMode): ?>

    <div class="form-control">
        <?= $value ?>
    </div>

<?php else: ?>

    <select name="<?= $name ?>">
      <option <?php if ($pid == 0): ?> selected <?php else: ?> <?php endif ?> value="0">顶级分类</option>
     <?php foreach ($values as $index => $title): ?>
       <option <?php if ($pid == $index): ?> selected <?php else: ?> <?php endif ?> value="<?= $index ?>"><?= $title ?></option>
     <?php endforeach ?>
     </select>

<?php endif ?>
